Apply __new__ approach to disabling __init__#484
Conversation
The starting point for this change was extracted from PR NVIDIA#458: * NVIDIA#458 (comment) * NVIDIA#458 (comment)
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test |
This comment has been minimized.
This comment has been minimized.
|
Looks fine to me! Merge? |
|
I forgot that I wanted to add a couple more small tests. Doing that now. |
|
@leofang Test coverage is now systematically complete, covering "front doors" and "back doors"; see comments added with commit eda324f. Testing that the back doors are locked is done through APIs that are unavoidably (for all practical purposes) visible through public APIs. Recently I experienced pushback when testing private functionality under the CCCL repo, so I asked ChatGPT about it: The lists of pros and cons are complex. I'm convinced it would be unproductive to be to pure one way or another, case-by-case judgement is important. That's how I decided to add tests that ensure the back doors are locked, and remain so. |
|
/ok to test |
leofang
left a comment
There was a problem hiding this comment.
LGTM other than fixing one error message.
| self._device_id = None # delayed | ||
| self._ctx_handle = None # delayed |
There was a problem hiding this comment.
IIUC this is actually a bug fix too! I wonder why it wasn't caught before...
| self._device_id = None # delayed | ||
| self._ctx_handle = None # delayed |
NVIDIA#484 (comment) Right now, if one wants to create a stream from a protocol-supported object, the intended way is to do `s = Device().create_stream(object_with_dunder_cuda_stream)`.
|
Since the previous run was green and the most recent change is comment-only, I suggest we admin-merge this without another CI run. @rwgk ready? |
Yes, please! :-) |
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Contributes to #198
Make disabling
__init__uniform across cuda.core:Use
@classmethodas the only constructor: Best for strict enforcement.Uniform
raise RuntimeError()with a standardized message form.The starting point for this change was extracted from PR #458:
Clearer error messages (cuda.core) #458 (comment)
Clearer error messages (cuda.core) #458 (comment)